#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QUrl>
#include <QUrlQuery>
#include <QRandomGenerator>
#include <QCryptographicHash>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QFileDialog>
#include <QDomDocument>
#include <QFile>
#include <QMap>
#include <QMessageBox>
#include <QTextStream>

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

public slots:
    void sendPostRequest();
    void recvReplyPost(QNetworkReply* reply);

private:
    Ui::MainWindow *ui;
    QNetworkAccessManager *manager;
    QDomDocument doc; //xml文档
    QDomNodeList nodeList;  //保存ts文件中的所有message节点
    int requestWordNum = 10;
    int recvNum = 0;
    QMap<QNetworkReply*, int> replyMap;

private:
    //私有方法
    void initView();
    void uiConnect();
    void sleep_test(unsigned int msec);
    void setUIEnable(bool enable);
    void saveTranslationResults();
};
#endif // MAINWINDOW_H
